package com.cl.pattern.factory.simple;

/**
 * 简单工厂类
 *
 * @Description
 * @Author Small
 * @Date 2020/6/3 18:48
 * @Version 1.0
 **/
public class ComputerFactory {

    /**
     * 创建电脑
     * @param branch  电脑品牌
     * @return
     */
    public static Computer createComputer(String branch) {
        Computer computer = null;
        switch (branch) {
            case "think":
                computer = new ThinkPad();
                break;
            case "lenovo":
                computer = new Lenovo();
                break;
            default:
                break;
        }
        return computer;
    }
}
